package com.vains.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vains.entity.OauthRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色表 Mapper 接口
 * </p>
 *
 * @author vains
 * @since 2020-06-08
 */
public interface OauthRoleMapper extends BaseMapper<OauthRole> {

    /**
     * 根据角色ID获取角色的权限
     * @param roleId 角色ID
     * @return 角色对应的权限
     */
    @Select("SELECT permission_id FROM oauth_role_permission WHERE role_id = #{roleId}")
    List<Integer> getPermissionsByRoleId(@Param("roleId") Integer roleId);
}
